<template>
  <div>
    <Appheader :parentToChild="ymname"></Appheader>
    <div class="content">
      <div class="title">{{info.name}}学校简介</div>
      <div class="min_title">来源：{{info.laiyuan}}&nbsp;&nbsp;&nbsp;&nbsp;更新时间：{{info.updatetime}}</div>
      <div id="container"></div>
    </div>

    <Appfooter></Appfooter>
  </div>
</template>

<script>
import Appheader from "../header";
import Appfooter from "../footer";
import { ykSchoolinfo } from "../../api/index";
export default {
  props: {},
  data() {
    return {
      ymname: "高校招生简章",
      id: "",
      info: {}
    };
  },
  computed: {},
  created() {},
  mounted() {
    this.id = this.$route.params.id || sessionStorage.getItem("school_id");
    sessionStorage.setItem("school_id", this.id);
    // console.log(this.id)
    this.post();
  },
  watch: {},
  methods: {
    post() {
      let msg = {
        id: this.id
      };
      ykSchoolinfo(this.qs(msg))
        .then(res => {
          this.info = res.data.ykSchool;
          var map = new AMap.Map("container", {
            resizeEnable: true
          });
          AMap.service(["AMap.PlaceSearch"], function() {
            //构造地点查询类
            var placeSearch = new AMap.PlaceSearch({
              pageIndex: 1, // 页码
              // city: res.data.ykSchool.examination, // 兴趣点城市
              citylimit: true, //是否强制限制在设置的城市内搜索
              map: map, // 展现结果的地图实例
              autoFitView: true // 是否自动调整地图视野使绘制的 Marker点都处于视口的可见范围
            });
            //关键字查询
            placeSearch.search(res.data.ykSchool.name);
          });
        })
        .catch(e => {});
    }
  },
  components: { Appheader, Appfooter }
};
</script>

<style scoped>
.content {
  width: 1200px;
  margin: 0 auto;
}
.title {
  font-size: 24px;
  color: rgba(51, 51, 51, 1);
  margin-top: 37px;
  margin-bottom: 15px;
  text-align: center;
}
.min_title {
  font-size: 14px;
  color: rgba(51, 51, 51, 1);
  margin-bottom: 45px;
  text-align: center;
}
.detail {
  font-size: 14px;
  color: rgba(51, 51, 51, 1);
}
#container {
  width: 1060px;
  height: 819px;
  margin:0 auto;
  margin-bottom:48px;
}
</style>
